<template>
  <div>
    <input type="text" v-model="keyword" />
    <ul>
      <li v-for="n in newArrr" :key="n.id">
        {{ n.name }}---{{ n.gender }}---{{ n.age }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      keyword: "",
      newArr: [
        {
          id: 564,
          name: "我点燃了火,却控制不了他,怎么半",
          gender: "男",
          age: 56,
        },
        {
          id: 231,
          name: "我控制自己不要想他,却还是忍不住",
          gender: "女",
          age: 56,
        },
        {
          id: 879,
          name: "她是她,你是你,你们两个注定在不了一齐",
          gender: "未知",
          age: 56,
        },
        {
          id: 111,
          name: "我为什么会迷上你,我心里也不知道答案呢",
          gender: "妖",
          age: 56,
        },
      ],
    };
  },
  // 编写计算属性
  computed: {
    newArrr() {
      return this.newArr.filter((p) => p.name.includes(this.keyword));
    },
  },
};
</script>

<style>
</style>